import req from '../common/network'

export default {
  // 获取所有活动及优惠券模板
  async list (params) {
    return await req({
      method: 'GET',
      url: '/coupons',
      params,
    })
  },
  // 新建活动或优惠券模板
  async create (data) {
    return await req({
      method: 'POST',
      url: '/coupons',
      data,
    })
  },
  // 编辑活动或优惠券模板
  async update (data) {
    return await req({
      method: 'PUT',
      url: `/coupons`,
      data,
    })
  },
  // 给用户发送优惠券
  async toUser (data) {
    return await req({
      method: 'POST',
      url: '/coupons/to_user',
      data,
    })
  },
   // 创建优惠卷
  async new (data) {
    return await req({
      method: 'POST',
      url: '/coupons/new',
      data,
    })
  },

  // 获取批量优惠券
  async list_all (params) {
    return await req({
      method: 'GET',
      url: '/coupons/list',
      params,
    })
  },
  // 获取渠道优惠券
  async list_channel (params) {
    return await req({
      method: 'GET',
      url: '/coupons/channel',
      params,
    })
  },
  // 删除渠道优惠券
  async delete_channel (params) {
    return await req({
      method: 'delete',
      url: '/coupons/channel',
      params,
    })
  },
}
